<template>
  <div class="learning-container">
    <NavIndex />
    <div class="learning-content">
      <div class="back-button-container">
        <button @click="goBack" class="back-button">
          <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
            <path d="M19 12H5M12 19l-7-7 7-7"/>
          </svg>
          返回
        </button>
      </div>
      
      <div class="learning-header">
        <h1>Vue.js 高级组件设计</h1>
        <div class="learning-meta">
          <span class="tag">前端</span>
          <span class="duration">预计学习时间: 4小时</span>
        </div>
      </div>
      
      <div class="learning-body">
        <div class="learning-section">
          <h2>课程概述</h2>
          <p>本课程将深入讲解Vue.js高级组件设计模式，包括可复用组件设计、高效状态管理、性能优化等核心内容。</p>
        </div>
        
        <div class="learning-section">
          <h2>学习目标</h2>
          <ul>
            <li>掌握Vue3 Composition API的高级用法</li>
            <li>学会设计可复用的组件库</li>
            <li>理解Vuex和Pinia状态管理</li>
            <li>掌握组件性能优化技巧</li>
          </ul>
        </div>
        
        <div class="learning-section">
          <h2>课程大纲</h2>
          <div class="course-outline">
            <div class="outline-item">
              <div class="outline-number">01</div>
              <div class="outline-content">
                <h3>Composition API深度解析</h3>
                <p>响应式原理、生命周期、依赖注入</p>
              </div>
            </div>
            <div class="outline-item">
              <div class="outline-number">02</div>
              <div class="outline-content">
                <h3>组件设计模式</h3>
                <p>高阶组件、Render Props、插槽设计</p>
              </div>
            </div>
            <div class="outline-item">
              <div class="outline-number">03</div>
              <div class="outline-content">
                <h3>状态管理进阶</h3>
                <p>Vuex模块化、Pinia最佳实践</p>
              </div>
            </div>
            <div class="outline-item">
              <div class="outline-number">04</div>
              <div class="outline-content">
                <h3>性能优化实战</h3>
                <p>懒加载、虚拟滚动、缓存策略</p>
              </div>
            </div>
          </div>
        </div>
        
        <div class="learning-actions">
          <button class="start-learning-btn">开始学习</button>
          <button class="preview-btn">预览课程</button>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup>
import { useRouter } from 'vue-router';
import NavIndex from "@/components/topNav/topNavIndex.vue";

const router = useRouter();

const goBack = () => {
  router.go(-1);
};
</script>

<style scoped>
.learning-container {
  min-height: 100vh;
  background-color: #f5f7fa;
  padding-top: 70px;
}

.learning-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 30px 20px;
}

.back-button-container {
  margin-bottom: 20px;
}

.back-button {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: #3498db;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.3s;
}

.back-button:hover {
  background: #2980b9;
  transform: translateX(-2px);
}

.back-button svg {
  width: 16px;
  height: 16px;
}

.learning-header {
  background: white;
  padding: 30px;
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  margin-bottom: 30px;
}

.learning-header h1 {
  color: #2c3e50;
  margin-bottom: 15px;
  font-size: 28px;
}

.learning-meta {
  display: flex;
  gap: 20px;
  align-items: center;
}

.tag {
  background: #3498db;
  color: white;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
}

.duration {
  color: #666;
  font-size: 14px;
}

.learning-body {
  background: white;
  padding: 30px;
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.learning-section {
  margin-bottom: 40px;
}

.learning-section h2 {
  color: #2c3e50;
  margin-bottom: 15px;
  font-size: 20px;
  border-bottom: 2px solid #3498db;
  padding-bottom: 8px;
}

.learning-section p {
  color: #555;
  line-height: 1.6;
  margin-bottom: 15px;
}

.learning-section ul {
  color: #555;
  line-height: 1.8;
}

.learning-section li {
  margin-bottom: 8px;
}

.course-outline {
  display: grid;
  gap: 20px;
}

.outline-item {
  display: flex;
  align-items: flex-start;
  gap: 15px;
  padding: 20px;
  background: #f8f9fa;
  border-radius: 8px;
  border-left: 4px solid #3498db;
}

.outline-number {
  background: #3498db;
  color: white;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  flex-shrink: 0;
}

.outline-content h3 {
  color: #2c3e50;
  margin-bottom: 5px;
  font-size: 16px;
}

.outline-content p {
  color: #666;
  margin: 0;
  font-size: 14px;
}

.learning-actions {
  display: flex;
  gap: 15px;
  justify-content: center;
  margin-top: 40px;
}

.start-learning-btn, .preview-btn {
  padding: 12px 30px;
  border: none;
  border-radius: 6px;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.3s;
}

.start-learning-btn {
  background: #3498db;
  color: white;
}

.start-learning-btn:hover {
  background: #2980b9;
}

.preview-btn {
  background: #ecf0f1;
  color: #2c3e50;
}

.preview-btn:hover {
  background: #bdc3c7;
}
</style> 